package com.sunday.authorization.mock.data.dto;

import com.sunday.common.core.gson.GsonUtils;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;


/**
 * 当前授权用户
 *
 * @author zsy
 * @since 2024/3/18
 */
@Slf4j
public class CurrentUser extends User {

//    // 角色集合
//    private Set<RoleDTO> roles;
//
//    // 角色最大等级
//    private Integer roleMaxLevel;

    @Getter
    @Setter
    // 权限总和
    private long[] permissionsSum;

    public CurrentUser(String username, String password, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
    }

    @Override
    public String toString() {
        return GsonUtils.DEFAULT.toJson(this);
    }

}
